knitr::opts_chunk$set(echo = TRUE)
library(rgdal)
## 載入需要的套件:sp
## Please note that rgdal will be retired during October 2023,
## plan transition to sf/stars/terra functions using GDAL and PROJ
## at your earliest convenience.
## See https://r-spatial.org/r/2023/05/15/evolution4.html and https://github.com/r-spatial/evolution
## rgdal: version: 1.6-7, (SVN revision 1203)
## Geospatial Data Abstraction Library extensions to R successfully loaded
## Loaded GDAL runtime: GDAL 3.7.2, released 2023/09/05
## Path to GDAL shared files: C:/Users/USER/AppData/Local/R/win-library/4.3/rgdal/gdal
## GDAL does not use iconv for recoding strings.
## GDAL binary built with GEOS: TRUE
## Loaded PROJ runtime: Rel. 9.3.0, September 1st, 2023, [PJ_VERSION: 930]
## Path to PROJ shared files: C:/Users/USER/AppData/Local/R/win-library/4.3/rgdal/proj
## PROJ CDN enabled: FALSE
## Linking to sp version:2.1-1
## To mute warnings of possible GDAL/OSR exportToProj4() degradation,
## use options("rgdal_show_exportToProj4_warnings"="none") before loading sp or rgdal.
library(leaflet)
taiwan <- readOGR('Data/COUNTY_MOI_1090820.shp', use_iconv=F, encoding='UTF-8')
## OGR data source with driver: ESRI Shapefile
## Source: "D:\R Github\r-class-rpp\Data\COUNTY_MOI_1090820.shp", layer: "COUNTY_MOI_1090820"
## with 22 features
## It has 4 fields
custom_label <- htmltools::tags$div(
style = "position=fixed; top=10; right=10;
background-color: white","Experiment Location")
leaflet(taiwan,) %>%
addPolygons(weight=0) %>%
addMarkers(
lng = c(121.55366636474005, 121.54389126730858, 121.53663439410937, 121.527973284159),
lat = c(25.01674026623676, 25.01987822525006, 25.03032128992012, 25.04595871511418))%>%
addProviderTiles("Stadia.AlidadeSmooth")%>%
addControl(custom_label, position = "topright")